<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Maven 构建工具全解析 | 技术小馆</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            color: #333;
            line-height: 1.6;
        }
        h1, h2, h3, h4 {
            font-family: 'Noto Serif SC', serif;
            font-weight: 600;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #6e8efb 0%, #4a6cf7 100%);
        }
        .card-hover {
            transition: all 0.3s ease;
        }
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        .code-block {
            background-color: #2d2d2d;
            color: #f8f8f2;
            border-radius: 0.375rem;
            position: relative;
        }
        .code-block::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 4px;
            height: 100%;
            background: #4a6cf7;
            border-radius: 0.375rem 0 0 0.375rem;
        }
        .phase-icon {
            width: 48px;
            height: 48px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-right: 1rem;
            flex-shrink: 0;
        }
        .timeline-item::before {
            content: '';
            position: absolute;
            left: 24px;
            top: 0;
            height: 100%;
            width: 2px;
            background: #e2e8f0;
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 px-4 md:px-0">
        <div class="container mx-auto max-w-6xl">
            <div class="flex flex-col md:flex-row items-center">
                <div class="md:w-1/2 mb-10 md:mb-0">
                    <div class="flex items-center mb-4">
                        <span class="bg-white bg-opacity-20 px-3 py-1 rounded-full text-sm">Java 开发</span>
                    </div>
                    <h1 class="text-4xl md:text-5xl font-bold mb-6 leading-tight">Maven 构建工具全解析</h1>
                    <p class="text-xl md:text-2xl opacity-90 mb-8">从生命周期到实战，掌握 Java 项目构建的核心流程</p>
                    <div class="flex space-x-4">
                        <a href="#lifecycle" class="bg-white text-blue-600 px-6 py-3 rounded-lg font-medium hover:bg-gray-100 transition duration-300">
                            <i class="fas fa-project-diagram mr-2"></i>生命周期
                        </a>
                        <a href="#practice" class="bg-white bg-opacity-20 px-6 py-3 rounded-lg font-medium hover:bg-opacity-30 transition duration-300">
                            <i class="fas fa-code mr-2"></i>实战演练
                        </a>
                    </div>
                </div>
                <div class="md:w-1/2 flex justify-center">
                    <div class="relative">
                        <div class="absolute -top-6 -left-6 w-24 h-24 bg-yellow-400 rounded-full opacity-20"></div>
                        <div class="absolute -bottom-6 -right-6 w-24 h-24 bg-purple-400 rounded-full opacity-20"></div>
                        <div class="relative bg-white bg-opacity-10 backdrop-blur-sm rounded-xl p-8 shadow-xl border border-white border-opacity-20">
                            <div class="flex items-center mb-6">
                                <div class="bg-blue-500 text-white p-3 rounded-lg mr-4">
                                    <i class="fas fa-cubes text-2xl"></i>
                                </div>
                                <h3 class="text-xl font-bold">构建自动化工具</h3>
                            </div>
                            <p class="mb-6 opacity-90">Maven 提供完整的生命周期管理，涵盖项目的清理、编译、测试、打包、验证、安装和部署等步骤。</p>
                            <div class="grid grid-cols-2 gap-4">
                                <div class="bg-white bg-opacity-10 p-3 rounded-lg">
                                    <p class="text-sm opacity-80 mb-1">依赖管理</p>
                                    <p class="font-semibold">自动解析</p>
                                </div>
                                <div class="bg-white bg-opacity-10 p-3 rounded-lg">
                                    <p class="text-sm opacity-80 mb-1">构建流程</p>
                                    <p class="font-semibold">标准化</p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <div class="container mx-auto max-w-6xl py-16 px-4">
        <!-- Introduction -->
        <section class="mb-20">
            <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
                <div class="p-8">
                    <div class="flex items-center mb-6">
                        <div class="bg-blue-100 text-blue-600 p-3 rounded-lg mr-4">
                            <i class="fas fa-info-circle text-2xl"></i>
                        </div>
                        <h2 class="text-2xl font-bold">Maven 简介</h2>
                    </div>
                    <p class="text-gray-700 mb-6">Maven 是 Java 开发中最常用的构建工具之一，它提供了完整的生命周期管理，涵盖了项目的清理、编译、测试、打包、验证、安装和部署等步骤。</p>
                    <div class="grid md:grid-cols-3 gap-6">
                        <div class="bg-gray-50 p-4 rounded-lg">
                            <div class="text-blue-600 mb-2">
                                <i class="fas fa-sync-alt"></i>
                            </div>
                            <h3 class="font-semibold mb-2">生命周期管理</h3>
                            <p class="text-sm text-gray-600">标准化的构建流程，减少配置复杂性</p>
                        </div>
                        <div class="bg-gray-50 p-4 rounded-lg">
                            <div class="text-blue-600 mb-2">
                                <i class="fas fa-boxes"></i>
                            </div>
                            <h3 class="font-semibold mb-2">依赖管理</h3>
                            <p class="text-sm text-gray-600">自动下载和管理项目依赖</p>
                        </div>
                        <div class="bg-gray-50 p-4 rounded-lg">
                            <div class="text-blue-600 mb-2">
                                <i class="fas fa-file-alt"></i>
                            </div>
                            <h3 class="font-semibold mb-2">POM 模型</h3>
                            <p class="text-sm text-gray-600">基于项目对象模型(POM)的配置方式</p>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Maven Lifecycle -->
        <section id="lifecycle" class="mb-20">
            <div class="flex items-center mb-8">
                <h2 class="text-3xl font-bold mr-4">1. Maven 生命周期概述</h2>
                <div class="bg-blue-100 text-blue-600 px-3 py-1 rounded-full text-sm font-medium">核心概念</div>
            </div>
            
            <p class="text-gray-700 mb-8">Maven 提供了三个主要的生命周期，每个生命周期包含多个阶段(phase)，这些阶段按顺序执行，前一个阶段的完成是后一个阶段执行的前提。</p>
            
            <div class="grid md:grid-cols-3 gap-6 mb-12">
                <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
                    <div class="bg-red-100 p-4">
                        <div class="flex items-center">
                            <div class="bg-red-500 text-white p-2 rounded-lg mr-3">
                                <i class="fas fa-broom"></i>
                            </div>
                            <h3 class="font-bold text-lg">clean 生命周期</h3>
                        </div>
                    </div>
                    <div class="p-6">
                        <p class="text-gray-700 mb-4">用于清理项目，删除编译生成的临时文件。</p>
                        <div class="bg-gray-50 p-3 rounded-lg">
                            <code class="text-sm font-mono text-red-600">mvn clean</code>
                        </div>
                    </div>
                </div>
                
                <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
                    <div class="bg-blue-100 p-4">
                        <div class="flex items-center">
                            <div class="bg-blue-500 text-white p-2 rounded-lg mr-3">
                                <i class="fas fa-cog"></i>
                            </div>
                            <h3 class="font-bold text-lg">default 生命周期</h3>
                        </div>
                    </div>
                    <div class="p-6">
                        <p class="text-gray-700 mb-4">包含项目构建的所有核心流程，从编译到打包。</p>
                        <div class="bg-gray-50 p-3 rounded-lg">
                            <code class="text-sm font-mono text-blue-600">mvn package</code>
                        </div>
                    </div>
                </div>
                
                <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
                    <div class="bg-green-100 p-4">
                        <div class="flex items-center">
                            <div class="bg-green-500 text-white p-2 rounded-lg mr-3">
                                <i class="fas fa-globe"></i>
                            </div>
                            <h3 class="font-bold text-lg">site 生命周期</h3>
                        </div>
                    </div>
                    <div class="p-6">
                        <p class="text-gray-700 mb-4">用于生成项目的站点文档。</p>
                        <div class="bg-gray-50 p-3 rounded-lg">
                            <code class="text-sm font-mono text-green-600">mvn site</code>
                        </div>
                    </div>
                </div>
            </div>
            
            <h3 class="text-2xl font-bold mb-6 text-gray-800">default 生命周期核心阶段</h3>
            
            <div class="relative">
                <div class="relative z-10">
                    <div class="bg-white rounded-xl shadow-md overflow-hidden mb-8">
                        <div class="bg-gray-50 px-6 py-4 border-b">
                            <div class="flex items-center">
                                <i class="fas fa-table mr-2 text-blue-600"></i>
                                <h4 class="font-semibold">Maven 构建阶段与命令</h4>
                            </div>
                        </div>
                        <div class="overflow-x-auto">
                            <table class="min-w-full divide-y divide-gray-200">
                                <thead class="bg-gray-50">
                                    <tr>
                                        <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">阶段</th>
                                        <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">命令</th>
                                        <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">作用</th>
                                    </tr>
                                </thead>
                                <tbody class="bg-white divide-y divide-gray-200">
                                    <tr>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900"><code>clean</code></td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500"><code>mvn clean</code></td>
                                        <td class="px-6 py-4 text-sm text-gray-500">删除 <code>target/</code> 目录，清理旧的构建文件</td>
                                    </tr>
                                    <tr class="bg-gray-50">
                                        <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900"><code>validate</code></td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500"><code>mvn validate</code></td>
                                        <td class="px-6 py-4 text-sm text-gray-500">验证项目结构、POM 配置等</td>
                                    </tr>
                                    <tr>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900"><code>compile</code></td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500"><code>mvn compile</code></td>
                                        <td class="px-6 py-4 text-sm text-gray-500">编译 Java 源代码到 <code>target/classes</code></td>
                                    </tr>
                                    <tr class="bg-gray-50">
                                        <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900"><code>test</code></td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500"><code>mvn test</code></td>
                                        <td class="px-6 py-4 text-sm text-gray-500">运行单元测试（依赖 <code>compile</code>）</td>
                                    </tr>
                                    <tr>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900"><code>package</code></td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500"><code>mvn package</code></td>
                                        <td class="px-6 py-4 text-sm text-gray-500">打包成 JAR 或 WAR 文件</td>
                                    </tr>
                                    <tr class="bg-gray-50">
                                        <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900"><code>verify</code></td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500"><code>mvn verify</code></td>
                                        <td class="px-6 py-4 text-sm text-gray-500">运行集成测试，确保包的有效性</td>
                                    </tr>
                                    <tr>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900"><code>install</code></td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500"><code>mvn install</code></td>
                                        <td class="px-6 py-4 text-sm text-gray-500">将构建的 JAR/WAR 安装到本地仓库</td>
                                    </tr>
                                    <tr class="bg-gray-50">
                                        <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900"><code>deploy</code></td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500"><code>mvn deploy</code></td>
                                        <td class="px-6 py-4 text-sm text-gray-500">将构建的包上传到远程仓库，供其他项目使用</td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                
                <div class="bg-white rounded-xl shadow-md overflow-hidden p-6 mb-12">
                    <h3 class="text-xl font-bold mb-4 text-gray-800">生命周期流程图</h3>
                    <div class="mermaid">
                        graph TD
                        A[clean] --> B[validate]
                        B --> C[compile]
                        C --> D[test]
                        D --> E[package]
                        E --> F[verify]
                        F --> G[install]
                        G --> H[deploy]
                    </div>
                </div>
            </div>
        </section>

        <!-- Practice Section -->
        <section id="practice" class="mb-20">
            <div class="flex items-center mb-8">
                <h2 class="text-3xl font-bold mr-4">2. 实践：完整的 Maven 构建流程</h2>
                <div class="bg-green-100 text-green-600 px-3 py-1 rounded-full text-sm font-medium">实战演练</div>
            </div>
            
            <div class="grid md:grid-cols-2 gap-8 mb-12">
                <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <div class="bg-purple-100 text-purple-600 p-3 rounded-lg mr-4">
                                <i class="fas fa-folder-open"></i>
                            </div>
                            <h3 class="text-xl font-bold">项目准备</h3>
                        </div>
                        <p class="text-gray-700 mb-4">假设我们有一个 Maven 项目，目录结构如下：</p>
                        <div class="code-block p-4 mb-4">
                            <pre class="text-sm font-mono"><code class="text-white">my-project
├── pom.xml
├── src
│   ├── main
│   │   └── java/com/demo/App.java
│   ├── test
│   │   └── java/com/demo/AppTest.java
└── target (Maven 构建后生成)</code></pre>
                        </div>
                        <p class="text-gray-700 mb-4">其中 <code>pom.xml</code> 配置如下：</p>
                        <div class="code-block p-4">
                            <pre class="text-sm font-mono"><code class="text-white">&lt;project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
    &lt;groupId&gt;com.demo&lt;/groupId&gt;
    &lt;artifactId&gt;my-project&lt;/artifactId&gt;
    &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
    &lt;dependencies&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;junit&lt;/groupId&gt;
            &lt;artifactId&gt;junit&lt;/artifactId&gt;
            &lt;version&gt;4.13.1&lt;/version&gt;
            &lt;scope&gt;test&lt;/scope&gt;
        &lt;/dependency&gt;
    &lt;/dependencies&gt;
&lt;/project&gt;</code></pre>
                        </div>
                    </div>
                </div>
                
                <div class="space-y-6">
                    <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
                        <div class="p-6">
                            <div class="flex items-center mb-4">
                                <div class="bg-red-100 text-red-600 p-3 rounded-lg mr-4">
                                    <i class="fas fa-broom"></i>
                                </div>
                                <h3 class="text-xl font-bold">清理项目</h3>
                            </div>
                            <p class="text-gray-700 mb-4">首先，执行以下命令清理项目：</p>
                            <div class="code-block p-4 mb-4">
                                <pre class="text-sm font-mono"><code class="text-white">mvn clean</code></pre>
                            </div>
                            <p class="text-gray-700">这个命令会删除 <code>target/</code> 目录，确保下次构建时不会受到历史编译文件的影响。</p>
                        </div>
                    </div>
                    
                    <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
                        <div class="p-6">
                            <div class="flex items-center mb-4">
                                <div class="bg-blue-100 text-blue-600 p-3 rounded-lg mr-4">
                                    <i class="fas fa-code"></i>
                                </div>
                                <h3 class="text-xl font-bold">编译源代码</h3>
                            </div>
                            <p class="text-gray-700 mb-4">执行以下命令编译 Java 代码：</p>
                            <div class="code-block p-4 mb-4">
                                <pre class="text-sm font-mono"><code class="text-white">mvn compile</code></pre>
                            </div>
                            <p class="text-gray-700">编译后的 <code>.class</code> 文件会存放在 <code>target/classes/</code> 目录中。</p>
                        </div>
                    </div>
                </div>
            </div>
            
            <div class="grid md:grid-cols-3 gap-6 mb-12">
                <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <div class="bg-yellow-100 text-yellow-600 p-3 rounded-lg mr-4">
                                <i class="fas fa-vial"></i>
                            </div>
                            <h3 class="text-xl font-bold">运行单元测试</h3>
                        </div>
                        <p class="text-gray-700 mb-4">Maven 在 <code>test</code> 阶段会自动运行 <code>src/test/java</code> 目录下的 JUnit 测试：</p>
                        <div class="code-block p-4 mb-4">
                            <pre class="text-sm font-mono"><code class="text-white">mvn test</code></pre>
                        </div>
                        <p class="text-gray-700">如果测试通过，会输出 <code>BUILD SUCCESS</code>，否则构建会终止。</p>
                    </div>
                </div>
                
                <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <div class="bg-indigo-100 text-indigo-600 p-3 rounded-lg mr-4">
                                <i class="fas fa-archive"></i>
                            </div>
                            <h3 class="text-xl font-bold">打包项目</h3>
                        </div>
                        <p class="text-gray-700 mb-4">执行：</p>
                        <div class="code-block p-4 mb-4">
                            <pre class="text-sm font-mono"><code class="text-white">mvn package</code></pre>
                        </div>
                        <p class="text-gray-700">Maven 会按照 <code>pom.xml</code> 的 <code>&lt;packaging&gt;</code> 方式（默认 <code>jar</code>），生成 <code>target/my-project-1.0-SNAPSHOT.jar</code>。</p>
                    </div>
                </div>
                
                <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <div class="bg-green-100 text-green-600 p-3 rounded-lg mr-4">
                                <i class="fas fa-check-double"></i>
                            </div>
                            <h3 class="text-xl font-bold">验证构建结果</h3>
                        </div>
                        <p class="text-gray-700 mb-4">执行 <code>mvn verify</code> 进行额外的检查，如集成测试：</p>
                        <div class="code-block p-4 mb-4">
                            <pre class="text-sm font-mono"><code class="text-white">mvn verify</code></pre>
                        </div>
                        <p class="text-gray-700">如果测试通过，说明构建的包符合质量标准。</p>
                    </div>
                </div>
            </div>
            
            <div class="grid md:grid-cols-2 gap-8">
                <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <div class="bg-blue-100 text-blue-600 p-3 rounded-lg mr-4">
                                <i class="fas fa-download"></i>
                            </div>
                            <h3 class="text-xl font-bold">安装到本地仓库</h3>
                        </div>
                        <p class="text-gray-700 mb-4">执行：</p>
                        <div class="code-block p-4 mb-4">
                            <pre class="text-sm font-mono"><code class="text-white">mvn install</code></pre>
                        </div>
                        <p class="text-gray-700">Maven 会将 <code>.jar</code> 文件安装到本地仓库（<code>~/.m2/repository</code>），方便其他本地项目引用。</p>
                    </div>
                </div>
                
                <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <div class="bg-purple-100 text-purple-600 p-3 rounded-lg mr-4">
                                <i class="fas fa-upload"></i>
                            </div>
                            <h3 class="text-xl font-bold">部署到远程仓库</h3>
                        </div>
                        <p class="text-gray-700 mb-4">如果你想共享构建成果，可以执行：</p>
                        <div class="code-block p-4 mb-4">
                            <pre class="text-sm font-mono"><code class="text-white">mvn deploy</code></pre>
                        </div>
                        <p class="text-gray-700">此命令会将 <code>.jar</code> 上传到远程仓库（如 Nexus 或 Artifactory），以供其他团队成员使用。</p>
                    </div>
                </div>
            </div>
        </section>

        <!-- Dependency Management -->
        <section class="mb-20">
            <div class="flex items-center mb-8">
                <h2 class="text-3xl font-bold mr-4">3. 依赖管理与优化</h2>
                <div class="bg-yellow-100 text-yellow-600 px-3 py-1 rounded-full text-sm font-medium">高级技巧</div>
            </div>
            
            <div class="grid md:grid-cols-2 gap-8 mb-12">
                <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <div class="bg-red-100 text-red-600 p-3 rounded-lg mr-4">
                                <i class="fas fa-exclamation-triangle"></i>
                            </div>
                            <h3 class="text-xl font-bold">解决依赖冲突</h3>
                        </div>
                        <p class="text-gray-700 mb-4">Maven 采用<strong>最近声明优先</strong>和<strong>最短路径优先</strong>的规则解析依赖冲突。可以使用以下命令查看依赖树：</p>
                        <div class="code-block p-4 mb-4">
                            <pre class="text-sm font-mono"><code class="text-white">mvn dependency:tree</code></pre>
                        </div>
                        <p class="text-gray-700">如果有冲突，可以在 <code>pom.xml</code> 中使用 <code>&lt;dependencyManagement&gt;</code> 来强制指定版本。</p>
                    </div>
                </div>
                
                <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <div class="bg-green-100 text-green-600 p-3 rounded-lg mr-4">
                                <i class="fas fa-tachometer-alt"></i>
                            </div>
                            <h3 class="text-xl font-bold">提高构建速度</h3>
                        </div>
                        <p class="text-gray-700 mb-2"><strong>启用并行构建</strong>（适用于多模块项目）：</p>
                        <div class="code-block p-4 mb-4">
                            <pre class="text-sm font-mono"><code class="text-white">mvn -T 1C install  # 使用 1 核心进行并行编译</code></pre>
                        </div>
                        <ul class="text-gray-700 space-y-2">
                            <li><strong>使用本地 Maven 仓库代理（如 Nexus）</strong>，减少外部依赖下载时间。</li>
                            <li><strong>跳过测试</strong>（仅用于开发调试，不推荐生产使用）：</li>
                        </ul>
                        <div class="code-block p-4 mt-2">
                            <pre class="text-sm font-mono"><code class="text-white">mvn package -DskipTests</code></pre>
                        </div>
                    </div>
                </div>
            </div>
            
            <div class="bg-white rounded-xl shadow-md overflow-hidden p-6">
                <h3 class="text-xl font-bold mb-6 text-gray-800">Maven 依赖解析顺序</h3>
                <div class="mermaid">
                    graph TD
                    A[依赖冲突] --> B[最近声明优先]
                    A --> C[最短路径优先]
                    B --> D[后声明的依赖覆盖先声明的]
                    C --> E[路径短的依赖覆盖路径长的]
                </div>
            </div>
        </section>

        <!-- Summary -->
        <section class="mb-20">
            <div class="bg-gradient-to-r from-blue-500 to-purple-600 rounded-xl p-8 text-white">
                <div class="flex flex-col md:flex-row items-center">
                    <div class="md:w-2/3 mb-6 md:mb-0">
                        <h2 class="text-2xl md:text-3xl font-bold mb-4">掌握 Maven 核心构建流程</h2>
                        <p class="opacity-90 mb-6">从项目清理到部署，Maven 提供了一套完整且标准化的构建流程，理解这些核心阶段是高效使用 Maven 的关键。</p>
                        <div class="flex space-x-4">
                            <a href="http://www.yuque.com/jtostring" class="bg-white text-blue-600 px-6 py-2 rounded-lg font-medium hover:bg-gray-100 transition duration-300">
                                了解更多
                            </a>
                            <a href="#lifecycle" class="bg-white bg-opacity-20 px-6 py-2 rounded-lg font-medium hover:bg-opacity-30 transition duration-300">
                                回顾生命周期
                            </a>
                        </div>
                    </div>
                    <div class="md:w-1/3 flex justify-center">
                        <div class="bg-white bg-opacity-20 p-6 rounded-full">
                            <i class="fas fa-check-circle text-4xl"></i>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </div>

    <!-- Footer -->
    <footer class="bg-gray-900 text-gray-300 py-12">
        <div class="container mx-auto max-w-6xl px-4">
            <div class="flex flex-col md:flex-row justify-between items-center">
                <div class="mb-6 md:mb-0">
                    <h3 class="text-xl font-bold text-white mb-2">技术小馆</h3>
                    <p class="text-gray-400">专业的开发技术分享平台</p>
                </div>
                <div>
                    <a href="http://www.yuque.com/jtostring" class="text-gray-300 hover:text-white transition duration-300">
                        <i class="fas fa-external-link-alt mr-2"></i>技术小馆地址：http://www.yuque.com/jtostring
                    </a>
                </div>
            </div>
            <div class="border-t border-gray-800 mt-8 pt-8 text-center text-gray-500 text-sm">
                &copy; 2023 技术小馆. 保留所有权利.
            </div>
        </div>
    </footer>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });
    </script>
</body>
</html>